package com.emep.changzhi.analyse.entity.basics;

import com.emep.changzhi.analyse.entity.outlet.SysOutletInfo;
import com.emep.changzhi.analyse.entity.systeminfo.SysUserInfo;
import io.swagger.annotations.ApiImplicitParam;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.*;

/**
* @author Wangcc
* @Description: 企业信息表
* @date 2018/2/24 9:05
* @version V1.0
*/
@Data
@Entity
@Table(name = "sys_company_info")
public class SysCompanyInfo  implements Serializable{

    private static final long serialVersionUID = 931882568448938215L;

    @Id
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @GeneratedValue(generator = "system-uuid")
    private String id;
    @Column(name = "company_name",columnDefinition="varchar(100) COMMENT '企业名称'")
    private String companyName;

    @Column(name = "company_shortname",columnDefinition="varchar(100) COMMENT '企业简称'")
    private String companyShortname;

    @Column(name = "company_address",columnDefinition="varchar(100) COMMENT '企业地址'")
    private String companyAddress;

    @Column(name = "company_type",columnDefinition="varchar(100) COMMENT '单位性质标识'")
    private String companyType;

    @Column(name = "longitude",columnDefinition="varchar(100) COMMENT '中心经度'")
    private String longitude;

    @Column(name = "latitude",columnDefinition="varchar(100) COMMENT '中心纬度'")
    private String latitude;

    @Column(name = "ep_name",columnDefinition="varchar(100) COMMENT '环保联系人'")
    private String epName;

    @Column(name = "ep_phone",columnDefinition="varchar(100) COMMENT '环保手机'")
    private String epPhone;

    @Column(name = "ep_email",columnDefinition="varchar(100) COMMENT '环保邮箱'")
    private String epEmail;

    @Column(name = "legal_person_name",columnDefinition="varchar(100) COMMENT '法人名字'")
    private String legalPersonName;

    @Column(name = "legal_person_phone",columnDefinition="varchar(100) COMMENT '法人手机'")
    private String legalPersonPhone;

    @Column(name = "legal_person_fax",columnDefinition="varchar(100) COMMENT '法人传真'")
    private String legalPersonFax;

    @Column(name = "legal_person_email",columnDefinition="varchar(100) COMMENT '法人邮箱'")
    private String legalPersonEmail;

    @Column(name = "build_date",columnDefinition="varchar(100) COMMENT '建厂时间'")
    private String buildDate;

    @Column(name = "production_date",columnDefinition="varchar(100) COMMENT '投产时间'")
    private String productionDate;

    @Column(name = "shutdown_date",columnDefinition="varchar(100) COMMENT '停产时间'")
    private String shutdownDate;

    @Column(name = "is_delete",columnDefinition="varchar(100) COMMENT '删除状态'")
    private String isDelete = "0";

    @Column(name = "organization_code",columnDefinition="varchar(100) COMMENT '组织机构代码'")
    private String organizationCode;

    @Column(name = "running_state",columnDefinition="varchar(100) COMMENT '运营状态 标识企业运营状态'")
    private String runningState;

    @Column(name = "is_electricity_kw",columnDefinition="varchar(100) COMMENT '是否30万千万以上的企业'")
    private String isElectricityKw;

    @Column(name = "create_date",columnDefinition="varchar(100) COMMENT '信息录入时间'")
    private String createDate = String.valueOf(System.currentTimeMillis());

    @Column(name = "organization_form",columnDefinition="varchar(100) COMMENT '组织形式'")
    private String organizationForm;

    @Column(name = "production",columnDefinition="varchar(100) COMMENT '主要产品'")
    private String production;

    @Column(name = "annual_output",columnDefinition="varchar(100) COMMENT '年产量'")
    private String annualOutput;

    @OneToMany(cascade={CascadeType.REFRESH,CascadeType.MERGE,CascadeType.REMOVE,CascadeType.PERSIST},fetch=FetchType.LAZY)
    private List<SysOutletInfo> outletInfoList = new ArrayList<SysOutletInfo>(0);

    /**
     * ManyToOne：多对一的配置
     * cascade(级联)：all(所有)，merge(更新)，refresh(查询)，persistence(保存)，remove(删除)
     * fetch: eager:立即加载  one的一方默认是立即加载
     *            lazy:懒加载    many的一方默认是懒加载
     *
     * JoinColumn:指定外键名
     *
     */
    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},fetch=FetchType.EAGER)
    @JoinColumn(name = "region_id")
    private SysRegionInfo sysRegionInfo ;

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},fetch=FetchType.EAGER)
    @JoinColumn(name = "key_id")
    private SysKeyTypeInfo sysKeyTypeInfos ;

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},fetch=FetchType.EAGER)
    @JoinColumn(name = "industrytype_id")
    private SysIndustryTypeInfo sysIndustryTypeInfos ;

    @ManyToOne(cascade={CascadeType.MERGE,CascadeType.REFRESH},fetch=FetchType.EAGER)
    @JoinColumn(name = "area_id")
    private SysAreaInfo sysAreaInfos ;


    @Column(name = "district_id",columnDefinition="varchar(100) COMMENT '新增的区域'")
    private String districtId;

    public SysCompanyInfo() {
    }
}
